extends Node2D

func _ready() -> void:
	EventBus.player_died.connect(reload.bind(0.2))
	EventBus.player_goldened.connect(reload.bind(2))
	EventBus.level_completed.connect(load_level_select)

func reload(delay: float) -> void:
	await get_tree().create_timer(delay).timeout
	get_tree().reload_current_scene()

func load_level_select() -> void:
	await get_tree().create_timer(1).timeout
	get_tree().change_scene_to_file("res://scenes/level_select/level_select.tscn")
